{% extends "base.html" %}

{% block title %}查看班级{% endblock %}

{% block content %}
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <h2 class="mb-4">班级详情</h2>
            <div class="card mb-4">
                <div class="card-body">
                    <h5 class="card-title">基本信息</h5>
                    <div class="row">
                        <div class="col-md-4">
                            <p><strong>年级：</strong>{{ class_obj.grade }}</p>
                        </div>
                        <div class="col-md-4">
                            <p><strong>年度：</strong>{{ class_obj.year }}</p>
                        </div>
                        <div class="col-md-4">
                            <p><strong>学期：</strong>{{ class_obj.semester }}</p>
                        </div>
                    </div>
                </div>
            </div>

            <h3 class="mb-3">注册学生列表</h3>
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>学生姓名</th>
                            <th>性别</th>
                            <th>家长关系</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for registration in registrations %}
                        <tr>
                            <td>{{ registration.name }}</td>
                            <td>{{ registration.gender }}</td>
                            <td>{{ registration.parent_relation }}</td>
                            <td>
                                <a href="{{ url_for('view_student', id=registration.student_id) }}" class="btn btn-sm btn-info">查看学生</a>
                            </td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>

            <div class="mt-3">
                <a href="{{ url_for('list_classes') }}" class="btn btn-secondary">返回列表</a>
            </div>
        </div>
    </div>
</div>
{% endblock %} 